
#pragma once

#include "cocos2d.h"

USING_NS_CC;

#include <string>
#include <vector>
#include <map>
#include <list>

using namespace std;

enum class BulletType;

#define floatEquals2(a,b)         (static_cast<float>(fabs(a - b)) < 0.01f)
#define pointEquals2(a, b)       (floatEquals2(a.x, b.x) && floatEquals2(a.y, b.y))

static const int TOUCH_MOVE_THRESHOLD = 5;

struct AnimationInfo {
	string key;
	float frameRate;
	vector<string> frames;

	AnimationInfo() {
		frameRate = 0;
	}
};

static const char *DAMAGE_TYPE_NAMES[] = {"slash", "blunt", "piercing", "explosion", "fire", "ice", "poison", "thunder", "dark", "holy"};

enum class DamageType {
	slash,
	blunt,
	piercing,
	explosion,
	fire,
	ice,
	poison,
	thunder,
	dark,
	holy,
	count
};

static const char *EQUIPMENT_TYPE_NAMES[] = {"creature", "weapon", "armor", "shield", "special"};

enum class CreatureName {
	human,
	orc,
	imp,
	catapult,
	cannon,
	ballista,
	undead,
	vermin,
	reptilian,
	golem,
	undead_catapult,
	steam_chariot,
	plague_cannon,
	giant_flamethrower,
	insectoid,
	lycanthrope,
	fishman,
	fire_elemental,
	water_elemental,
	poison_elemental,
	thunder_elemental,
	octopod,
	steam_behemoth,
	demon,
	angel,
};

enum class EquipmentType {
	creature,
	weapon,
	armor,
	shield,
	special,
	count
};

enum class EquipmentGenre {
	creature_angel,
	creature_conquest,
	creature_death,
	creature_demon,
	creature_famine,
	creature_fishman,
	creature_golem,
	creature_human,
	creature_imp,
	creature_insectoid,
	creature_lycanthrope,
	creature_octopod,
	creature_orc,
	creature_reptilian,
	creature_undead,
	creature_vermin,
	creature_war,
	artillery_3case,
	artillery_6case,
	artillery_9case,
	creature_poison_elemental,
	creature_fire_elemental,
	creature_thunder_elemental,
	creature_water_elemental,
	weapon_1hand,
	weapon_2hand,
	weapon_bow,
	weapon_musket,
	weapon_pistol,
	weapon_spear,
	weapon_staff,
	armor,
	shield,
	special,
	special_boar,
	special_horse,
	count
};

static const char *EQUIPMENT_GENRE_NAMES[] = {
		"creature_angel",
		"creature_conquest",
		"creature_death",
		"creature_demon",
		"creature_famine",
		"creature_fishman",
		"creature_golem",
		"creature_human",
		"creature_imp",
		"creature_insectoid",
		"creature_lycanthrope",
		"creature_octopod",
		"creature_orc",
		"creature_reptilian",
		"creature_undead",
		"creature_vermin",
		"creature_war",
		"artillery_3case",
		"artillery_6case",
		"artillery_9case",
		"creature_poison_elemental",
		"creature_fire_elemental",
		"creature_thunder_elemental",
		"creature_water_elemental",
		"weapon_1hand",
		"weapon_2hand",
		"weapon_bow",
		"weapon_musket",
		"weapon_pistol",
		"weapon_spear",
		"weapon_staff",
		"armor",
		"shield",
		"special",
		"special_boar",
		"special_horse",
};

static const char *CREATURE_TYPE_NAMES[] = {
		"1hand_weapon",
		"2hand_weapon",
		"spear",
		"bow",
		"pistol",
		"musket",
		"staff",
		"ballista",
		"cannon",
		"plague_cannon",
		"catapult",
		"undead_catapult",
		"giant_flamethrower",
		"steam_behemoth",
		"steam_chariot",
};

enum CreatureType {
	one_hand_weapon,
	two_hand_weapon,
	spear,
	bow,
	pistol,
	musket,
	staff,
	ballista,
	cannon,
	plague_cannon,
	catapult,
	undead_catapult,
	giant_flamethrower,
	steam_behemoth,
	steam_chariot,
	count
};

static const char *RARITY_NAMES[] = {"common", "uncommon", "rare", "legendary",};

enum class EquipmentRarity {
	common,
	uncommon,
	rare,
	legendary,
	count
};

enum class EquipmentSlotType {
	weapon,
	armor,
	shield,
	special,
	count
};

static const char *ATTACK_TYPE_NAMES[] = {
		"none",
		"cast_all_units",
		"cast_aoe_melee",
		"cast_enemy_units",
		"cast_full_line",
		"cast_squad_front_line",
		"cast_buff_squad_single_attack",
		"morph_demon",
		"single_attack",
		"splash_balista",
		"splash_canon",
		"splash_giant_flamer",
		"splash_steam_chariot",
		"steam_behemoth",
};

enum class AttackType {
	none,
	cast_all_units,
	cast_aoe_melee,
	cast_enemy_units,
	cast_full_line,
	cast_squad_front_line,
	cast_buff_squad_single_attack,
	morph_demon,
	single_attack,
	splash_balista,
	splash_canon,
	splash_giant_flamer,
	splash_steam_chariot,
	steam_behemoth,
	count,
};

static const char *BULLET_PROJECTILE_TYPE_NAMES[] = {
		"none",
		"arrow",
		"balista",
		"cannon",
		"catapult",
		"giant_flamer",
		"musket",
		"pistol",
		"steam_behemot",
		"acid_rain_staff",
		"armagedon_staff",
		"blazing_staff",
		"dark_staff",
		"fireblast_staff",
		"fire_staff",
		"frost_bite_staff",
		"holy_staff",
		"ices_taff",
		"icestorm_staff",
		"lightning_staff",
		"okkoraz_staff",
		"oryth_staff",
		"plague_staff",
		"poison_staff",
		"solar_staff",
		"thunder_staff",
		"thunderstorm_staff",
		"vasspotanax_staff",
		"xonax_staff",
		"yasur_staff",
};

enum class BulletProjectileType {
	none,
	arrow,
	balista,
	cannon,
	catapult,
	giant_flamer,
	musket,
	pistol,
	steam_behemot,
	acid_rain_staff,
	armagedon_staff,
	blazing_staff,
	dark_staff,
	fireblast_staff,
	fire_staff,
	frost_bite_staff,
	holy_staff,
	ices_taff,
	icestorm_staff,
	lightning_staff,
	okkoraz_staff,
	oryth_staff,
	plague_staff,
	poison_staff,
	solar_staff,
	thunder_staff,
	thunderstorm_staff,
	vasspotanax_staff,
	xonax_staff,
	yasur_staff,
	count,
};

static const char *EQUIPMENT_EFFECT_TYPE_NAMES[] = {
		"none",
		"aura_antimagic_field",
		"aura_aodan_shield",
		"aura_apocalypse_horse",
		"aura_arhalath_ring",
		"aura_azaratius_orb",
		"aura_barbarian_flag",
		"aura_bolt_flag",
		"aura_cleric_flag",
		"aura_conquest",
		"aura_cult_flag",
		"aura_empire_armor",
		"aura_empire_seal",
		"aura_famine",
		"aura_flame_flag",
		"aura_frost_flag",
		"aura_gazatah_handbook",
		"aura_gordakar_plate",
		"aura_gordakar_shield",
		"aura_mokdar_shield",
		"aura_necropol_mail",
		"aura_orc_leader_crown",
		"aura_oryth_shield",
		"aura_pikeman_flag",
		"aura_quaek_talisman",
		"aura_quatiazsword",
		"aura_sapper_flag",
		"aura_static_orb",
		"aura_swordsman_flag",
		"aura_tower_flag",
		"aura_ultima_staff",
		"aura_ultra_ring",
		"aura_ultra_shield",
		"aura_unicorn",
		"aura_vasspotanax_plate",
		"aura_viper_flag",
		"aura_war",
		"aura_xonax_buckler",
		"aura_xonax_mail",
		"aura_xonaxstaff",
		"aura_yasur_armor",
		"die_effect_bax_robe",
		"die_effect_cultist_robe",
		"die_effect_deflagration_scale",
		"die_effect_immortal_armor",
		"die_effect_magma_breastplate",
		"die_effect_nataobeth_orb",
		"die_effect_nataobeth_plate_explode",
		"die_effect_undead_horse",
		"die_effect_untmori_plate",
		"onattack_effect_bolt_hammer",
		"onattack_effect_frost_axe",
		"onattack_effect_plague_spike",
		"onattack_effect_pyro_blade",
		"onkill_effect_mech_beast",
		"onkill_effect_necron_blade",
		"onkill_effect_saint_blade",
		"onraiseundead_yasur_ring",
		"onstart_effect_tuloran_plate",
		"stats_modifier_archmage_mail_modifier",
		"stats_modifier_cursed_ring",
		"stats_modifier_icy_robe_modifier",
		"stats_modifier_luminary_ring_modifier",
		"stats_modifier_mage_robe_modifier",
		"stats_modifier_octopod_modifier",
		"stats_modifier_timeslow_ring_modifier",
		"stats_modifier_timewarp_ring_modifier",
		"stats_modifier_umenth_armor_modifier",
		"stats_modifier_wizard_ring_modifier",
		"timed_effect_azaratius_axe",
		"timed_effect_death",
		"timed_effect_imraill_mace",
		"timed_effect_necro_gear",
		"timed_effect_regen_luminarymail",
		"timed_effect_regen_necklace",
		"timed_effect_regen_soldierorb",
		"timed_effect_timedead",
		"timed_effect_timemorph_larva",
		"timed_effect_xonax_skin",
		"timed_effect_zamaroth_sword_dmg",
};

enum class EquipmentEffectType {
	none,
	aura_antimagic_field,
	aura_aodan_shield,
	aura_apocalypse_horse,
	aura_arhalath_ring,
	aura_azaratius_orb,
	aura_barbarian_flag,
	aura_bolt_flag,
	aura_cleric_flag,
	aura_conquest,
	aura_cult_flag,
	aura_empire_armor,
	aura_empire_seal,
	aura_famine,
	aura_flame_flag,
	aura_frost_flag,
	aura_gazatah_handbook,
	aura_gordakar_plate,
	aura_gordakar_shield,
	aura_mokdar_shield,
	aura_necropol_mail,
	aura_orc_leader_crown,
	aura_oryth_shield,
	aura_pikeman_flag,
	aura_quaek_talisman,
	aura_quatiazsword,
	aura_sapper_flag,
	aura_static_orb,
	aura_swordsman_flag,
	aura_tower_flag,
	aura_ultima_staff,
	aura_ultra_ring,
	aura_ultra_shield,
	aura_unicorn,
	aura_vasspotanax_plate,
	aura_viper_flag,
	aura_war,
	aura_xonax_buckler,
	aura_xonax_mail,
	aura_xonaxstaff,
	aura_yasur_armor,
	die_effect_bax_robe,
	die_effect_cultist_robe,
	die_effect_deflagration_scale,
	die_effect_immortal_armor,
	die_effect_magma_breastplate,
	die_effect_nataobeth_orb,
	die_effect_nataobeth_plate_explode,
	die_effect_undead_horse,
	die_effect_untmori_plate,
	onattack_effect_bolt_hammer,
	onattack_effect_frost_axe,
	onattack_effect_plague_spike,
	onattack_effect_pyro_blade,
	onkill_effect_mech_beast,
	onkill_effect_necron_blade,
	onkill_effect_saint_blade,
	onraiseundead_yasur_ring,
	onstart_effect_tuloran_plate,
	stats_modifier_archmage_mail_modifier,
	stats_modifier_cursed_ring,
	stats_modifier_icy_robe_modifier,
	stats_modifier_luminary_ring_modifier,
	stats_modifier_mage_robe_modifier,
	stats_modifier_octopod_modifier,
	stats_modifier_timeslow_ring_modifier,
	stats_modifier_timewarp_ring_modifier,
	stats_modifier_umenth_armor_modifier,
	stats_modifier_wizard_ring_modifier,
	timed_effect_azaratius_axe,
	timed_effect_death,
	timed_effect_imraill_mace,
	timed_effect_necro_gear,
	timed_effect_regen_luminarymail,
	timed_effect_regen_necklace,
	timed_effect_regen_soldierorb,
	timed_effect_timedead,
	timed_effect_timemorph_larva,
	timed_effect_xonax_skin,
	timed_effect_zamaroth_sword_dmg,
	count,
};


static const char *UNIT_STATE_NAMES[] = {
		"birth",
		"idle",
		"walk",
		"aim",
		"attack01",
		"reload",
		"walkaim",
		"walkattack",
		"walkreload",
		"die",
		"die",
};

enum class UnitState {
	birth,
	idle,
	walk,
	aim,
	attack,
	reload,
	walk_aim,
	walk_attack,
	walk_reload,
	dying,
	died,
	count
};
